<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>welcome</title>
</head>
<body>
<button onclick="localRefresh()">点击刷新</button>
<div th:fragment="refresh" id="refresh"><p th:text="${user.getName()}"></p></div>
</body>
<script th:src="@{/js/jquery-3.1.1.min.js}"></script>
<script th:inline="javascript">
    console.log([[${user}]]);
    function localRefresh() {
        // 装载局部刷新返回的页面
        $('#refresh').load("index1");
        console.log([[${user}]]);

    }
</script>

</html>